package com.cy.pj.brand.dao;

import com.cy.pj.brand.pojo.Brand;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

//复杂sql(例如嵌套了很多动态sql元素)不建议已注解方式进行定义
//@Select("<script>select * from tb_brand <if test=\"name!=null and name!=''\"> where name like concat (\"%\",#{name},\"%\")</if></script>")
@Mapper
public interface BrandDao {
   //查询品牌模块
  /* @Select("<script>select * from tb_brand <if test=\"name!=null and name!=''\"> " +
            "where name like concat(\"%\",#{name},\"%\")</if></script>")*/
   //@Select("select * from tb_brand")
   List<Brand> findBrands(String name);

   //删除品牌模块(根据id删除)
   //@Delete("delete from tb_brand where id=#{id}")
   int deleteById(Integer id);

   //新增品牌模块
   //@Insert("insert into tb_brand(name,remark,createdTime) values (#{name},#{remark},#{createdTime})")
   int insertBrand(Brand entity);

   //修改品牌模块
   //@Select("select * from tb_brand where id=#{id}")
   Brand findByIds(Integer id);
   //@Update("update tb_brand set name=#{name},remark=#{remark},createdTime=#{createdTime} where id=#{id};")
   int updateBrand(Brand brand);
}
